package com.m3u8;

import android.os.Parcel;
import android.os.Parcelable;

public class RequestInfo implements Parcelable {

    public long m3u8Id;
    public String m3u8url;
    public String name;
    public String m3u8Path;
    public String basePath;
    public int requestStats;
    public int state;
    public int process;

    public RequestInfo() {
        super();
    }

    protected RequestInfo(Parcel in) {
        super();
        m3u8Id = in.readLong();
        m3u8url = in.readString();
        name = in.readString();
        m3u8Path = in.readString();
        basePath = in.readString();
        requestStats = in.readInt();
        state = in.readInt();
        process = in.readInt();
    }

    public static final Creator<RequestInfo> CREATOR = new Creator<RequestInfo>() {
        @Override
        public RequestInfo createFromParcel(Parcel in) {
            return new RequestInfo(in);
        }

        @Override
        public RequestInfo[] newArray(int size) {
            return new RequestInfo[size];
        }
    };

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeLong(m3u8Id);
        dest.writeString(m3u8url);
        dest.writeString(name);
        dest.writeString(m3u8Path);
        dest.writeString(basePath);
        dest.writeInt(requestStats);
        dest.writeInt(state);
        dest.writeInt(process);
    }

    public static class Builder {
        private String m3u8url;
        private String name;
        private String m3u8Path;
        private String basePath;

        public Builder setM3u8url(String m3u8url) {
            this.m3u8url = m3u8url;
            return this;
        }

        public Builder setName(String name) {
            this.name = name;
            return this;
        }

        public Builder setM3u8Path(String m3u8Path) {
            this.m3u8Path = m3u8Path;
            return this;
        }

        public Builder setBasePath(String basePath) {
            this.basePath = basePath;
            return this;
        }

        public RequestInfo build() {
            RequestInfo requestInfo = new RequestInfo();
            requestInfo.m3u8Path = m3u8Path;
            requestInfo.m3u8url = m3u8url;
            requestInfo.name = name;
            requestInfo.basePath = basePath;
            return requestInfo;
        }
    }
}
